﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace processOfNumGroup
{
	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
		}
		public int getBiggest(string[] s)
		{
			int big = int.Parse(s[0]);
			for(int i = 1; i < s.Length; i++)
			{
				if (big < int.Parse(s[i]))
				{
					big = int.Parse(s[i]);	
				}
			}
			return big;
		}
		public int getSmallest(string[] s)
		{
			int small = int.Parse(s[0]);
			for (int i = 1; i < s.Length; i++)
			{
				if (small > int.Parse(s[i]))
				{
					small = int.Parse(s[i]);
				}
			}
			return small;
		}
		public double getAverage(string[] s)
		{
			double x = 0;
			for (int i = 0; i < s.Length; i++)
			{
				x += int.Parse(s[i]);
			}
			return x/s.Length;
		}
		public int getSum(string[] s)
		{
			int x = 0;
			for (int i = 0; i < s.Length; i++)
			{
				x += int.Parse(s[i]);
			}
			return x;
		}
		private void button1_Click(object sender, EventArgs e)
		{
			string s = textBoxOfNumGroup.Text;
			string[] group = s.Split(',');
			textBox1.AppendText("最小值：" + getSmallest(group) + " 最大值：" + getBiggest(group) + " 平均值：" + getAverage(group)+" 和为："+getSum(group));
			
		}
	}
}
